/**
 * 
 */
package cs534.util;

/**
 * @author jhostetler
 *
 */
public class StringUtil 
{	
	public static String join( final String sep, final String ... strings )
	{
		final StringBuilder sb = new StringBuilder();
		boolean comma = false;
		for( final String s : strings ) {
			if( comma ) {
				sb.append( sep );
			}
			else {
				comma = true;
			}
			
			sb.append( s );
		}
		
		return sb.toString();
	}
	
	public static <T> String join( final String sep, final T[] things )
	{
		final StringBuilder sb = new StringBuilder();
		boolean comma = false;
		for( final T t : things ) {
			if( comma ) {
				sb.append( sep );
			}
			else {
				comma = true;
			}
			
			sb.append( t.toString() );
		}
		
		return sb.toString();
	}
}
